
cc.Class({
    extends: cc.Component,

    properties: {
        Portrait:cc.Sprite,
        Name:cc.Label,
        Dialect:cc.Label,
        Answer:cc.Label,
        LikesQuantity:cc.Label,
    },
    init:function (idx,data) {
        this.getloader(data.url);
        this.UserId = idx;
        this.Name.string = data.name;
        this.Dialect.string = "方言："+data.Dialect;
        this.Answer.string = "他的回答："+data.Answer;
        this.LikesQuantity.string = data.LikesQuantity;
    },
    getloader:function(URL){
        var self = this;
        cc.loader.load({url: URL, type: 'png'}, function (err, texture) {
            self.Portrait.spriteFrame = new cc.SpriteFrame(texture)
        })
    },
    onClick(){
        console.log("排行榜："+this.UserId+"点赞数加一");
        this.LikesQuantity.string = parseInt(this.LikesQuantity.string)+1;
    }
});
